<!DOCTYPE html>
<html  xmlns:https="http://www.w3.org/1999/xhtml"
        xmlns:th="http://www.thymeleaf.org">

<head>
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="robots" content="all,follow">

    <title>我的订单</title>
    <link rel="shortcut icon" href="/img/favicon.ico">
    
    <!-- global stylesheets -->
    <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="/css/font-icon-style.css">
    <link rel="stylesheet" href="/css/style.default.css" id="theme-stylesheet">
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript">
    //   function(){
    //   $(".search-input").on("input propertychange", function() {
    //     var queryStr = $.trim($(".search-input").val());
    //     if(queryStr === ''){
    //       $(".list-content li").show();
    //     }else{
    //     // 以下是匹配某些列的内容，如果是匹配全部列的话就把find()和.parent()去掉即可
    //       $(".list-content li").hide().find(".code, .name").filter(":contains('"+queryStr+"')").parent("li").show();
    //       //$(".list-content").refresh(); //重新刷新列表把隐藏的dom结构去掉。
    //     }
    //   });
    // }

    // function save(var order){
    //       sessionStorage.setItem("order",order);
    // }

  function audit(id) {
      $.ajax({
          //请求方式
          type: "POST",
          //请求的媒体类型
          dataType: "json",
          //请求地址
          url: "/contract/findAuditApproval",
          //数据，json字符串
          data: {"id": id},
          //请求成功
          success: function (data) {
              $("#att").attr("href", "/contract/download?id="+data.audit.attId);
              $("#result").text(data.approval[0].result);
              $("#content").text(data.approval[0].content);
          }
      });
  }
    </script>
    <!-- Core stylesheets -->
</head>

<body>
<!--====================================================
                        PAGE CONTENT
======================================================-->
    <div class="content-inner form-cont">
            <div class="row">
                <div class="col-md-12">

                    <!--***** BASIC FORM *****-->
                    <div class="card form" id="form1">
                        <div class="card-header">
                            <h3>订单查询</h3>
                        </div>
                        <br>
                        <form>
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="example-text-input" style="width: 85px;" class=" col-form-label">订单编号</label>
                                        <div class="col-9">
                                            <input name="orderNum" class="form-control" type="text" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label style="width: 85px;"  class=" col-form-label">订单类型</label>
                                        <div class="col-9">
                                            <select class="form-control">
                                                <option value="">选择类型</option>
                                                <option value="">公司服务</option>
                                                <option value="">法律文书</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label style="width: 85px;"  class=" col-form-label">订单状态</label>
                                        <div class="col-9">
                                            <select class="form-control">
                                                <option value="">选择状态</option>
                                                <option value="">暂无</option>
                                                <option value=""></option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="" style="width: 85px;" class=" col-form-label">创建日期</label>
                                        <div class="col-9">
                                            <input name="createTime" class="form-control" type="datetime-local" value="yyyy-mm-ddT00:00">
                                        </div>
                                        <label for="" style="width: 85px;" class=" col-form-label">至</label>
                                        <div class="col-9">
                                            <input name="to" class="form-control" type="datetime-local" value="yyyy-mm-ddT00:00">
                                        </div>
                                    </div>
                                    <button type="submit" class="btn btn-general btn-blue mr-2">查询</button>  
                                    <button type="reset" class="btn btn-general btn-white">重置</button> 
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
    <div class="page-content d-flex align-items-stretch">
        <div class="content-inner chart-cont">
            <!--***** CONTENT *****-->
            <div class="row">
                <table class="table table-hover">
                  <thead>
                    <tr class="bg-info text-white">
                      <th>#</th>
                      <th>产品名称</th>
                      <th>订单类型</th>
                      <th>金额（元）</th>
                      <th>订单状态</th>
                      <th>下一步流程</th>
                      <th>付款状态</th>
                      <th style="text-align: center;">操作</th>
                    </tr>
                  </thead>
                  <tbody id="table-detail">
                    <tr th:each="order:${orders}" th:if="${not #lists.isEmpty(order.products)}">
                      <th th:text="${orderStat.count}">1</th>
                      <td th:text="${order.products[0].productName}"></td>
                      <td th:text="${order.products[0].productType}"></td>
                      <td th:text="${order.products[0].price}"></td>
                      <td th:text="${order.status}"></td>
                      <td th:text="${order.nextStatus}"></td>
                      <td th:text="${order.payStatus}"></td>
                      <td>
                            <a href="#" data-toggle="modal" data-target="#myModal">详情|</a>
                            <a th:href="@{/order/update/已付款/{id}(id=${order.id})}">付款|</a>
                            <a th:href="@{/order/update/确认付款/{id}(id=${order.id})}">确认付款|</a>
                            <a th:href="@{/order/delete/{id}(id=${order.id})}">取消订单|</a>
                            <a href="#" data-toggle="modal" data-target="#check" th:if="${order.approval}">审核回馈|</a>
                            <a href="#" data-toggle="modal" data-target="#auditModal" th:onclick="'javascript:audit('+${order.id}+')'">合同审批</a>
                          <!--<a href="#">评价</a>-->
                      </td>

                        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                            &times;
                                        </button>
                                        <h4 class="modal-title" id="myModalLabel">
                                            订单详情
                                        </h4>
                                    </div>
                                    <div class="modal-body">
                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label"> 订单编号：</label>
                                        <div class="col-9">
                                            <span th:text="${order.orderNum}"/>
                                        </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label"> 订单名称：</label>
                                            <div class="col-9">
                                                <span th:text="${order.orderName}"/>
                                            </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label"> 服务类型：</label>
                                            <div class="col-9">
                                        <span th:text="${order.products[0].productType}"/>
                                        </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label"> 受理状态：</label>
                                            <div class="col-9">
                                        <span th:text="${order.status}"/>
                                        </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label"> 订单状态：</label>

                                            <div class="col-9">
                                        <span th:text="${order.status}"/>
                                        </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label"> 创建时间：</label>

                                            <div class="col-9">
                                        <span th:text="${order.createTime}"/>
                                        </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">更新时间：</label>

                                            <div class="col-9">

                                        <span th:text="${order.updateTime}"/>
                                        </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">创建人：</label>
                                            <div class="col-9">
                                        <span th:text="${order.createBy}"/>
                                        </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">修改人：</label>

                                            <div class="col-9">

                                        <span th:text="${order.updateBy}"/>
                                        </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">下一步流程：</label>

                                            <div class="col-9">
                                        <span th:text="${order.nextStatus}"/>
                                        </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">支付状态：</label>

                                            <div class="col-9">
                                        <span th:text="${order.payStatus}"/>
                                        </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">接收人：</label>

                                            <div class="col-9">

                                        <span th:text="${order.acceptUserId}"/>
                                        </div>
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                                        </button>
                                    </div>
                                </div><!-- /.modal-content -->
                            </div><!-- /.modal -->
                        </div>

                        <div class="modal fade" id="check" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            <div class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                            &times;
                                        </button>
                                        <h4 class="modal-title" id="myModalLabel">
                                            订单审核详情
                                        </h4>
                                    </div>
                                    <div class="modal-body">

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label"></label>

                                            <div class="col-9">
                                                您的订单审核状态结果为：
                                            </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label"></label>

                                            <div class="col-9">
                                                <textarea th:if="${order.approval}"  class="form-control" rows="5" th:text="${order.approval.content}">123</textarea>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label for="exampleInputFile" style="width: 60px;">附件：</label>
                                            <a th:if="${order.approval}" th:href="@{/contract/download/{id}(id=${order.approval.attGroupId})}">公司办理附件下载</a>
                                            <!--<a id="att" th:href="@{/approval/find/{id}(id=${order.approval.id})}">信息办理文档下载</a><br/>-->
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                                        </button>
                                    </div>
                                </div><!-- /.modal-content -->
                            </div><!-- /.modal -->
                        </div>
                    </tr>

                    <!-- 合同审批模态框（Modal） -->
                    <div class="modal fade" id="auditModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                                        &times;
                                    </button>
                                    <h4 class="modal-title" id="auditModalLabel">
                                        合同审批
                                    </h4>
                                </div>
                                <div class="modal-body">

                                    <div class="form-group row">
                                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">审核结果：</label>
                                        <div class="col-9">
                                            <span id="result">暂无</span>
                                        </div>
                                    </div>
                                    <div class="form-group row">
                                        <label for="example-text-input" style="width: 85px;margin-left: 20px;" class=" col-form-label">审核意见：</label>
                                        <div class="col-9">
                                            <span id="content">暂无</span>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleInputFile" style="width: 85px;">附件</label>
                                        <a id="att">合同文档</a><br/>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                                        </button>
                                    </div>
                                </div><!-- /.modal-content -->
                            </div><!-- /.modal -->
                        </div>
                    </div>
                  </tbody>
                </table>
                <div  class="c-pages">
                  <div class="cp-item">
                      <span>共</span>
                      <span id="cp-count">0</span>
                      <span>条</span>
                  </div>
                  <div class="cp-item">
                      <span id="curr-page">1</span>
                      <span>/</span>
                      <span id="total-page">1</span>
                  </div>
                  <div class="cp-item">
                      <button id="home" class="btn btn-outline-primary">首页</button>
                      <button id="prev" class="btn btn-outline-primary">上页</button>
                      <input type="number" id="goToPage" />
                      <button id="goTo" class="btn btn-outline-primary">转到</button>
                      <button id="next" class="btn btn-outline-primary">下页</button>
                      <button id="last" class="btn btn-outline-primary">尾页</button>
                  </div>

            </div>
            </div>
        </div>
    </div>
    <!-- 模态框（Modal） -->

    <!--Global Javascript -->
    <script src="/js/jquery.min.js"></script>
    <script src="/js/popper/popper.min.js"></script>
    <script src="/js/tether.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/jquery.cookie.js"></script>
    <script src="/js/jquery.validate.min.js"></script>
    <script src="/js/chart.min.js"></script>
    <script src="/js/front.js"></script>
    <script src="/js/forpage.js"></script>
</body>

</html>